//
//  CleanKingViewController.m
//  GoodWayClient
//
//  Created by newhuidong on 15/12/22.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "CleanKingViewController.h"
#import "AFNetworking.h"
#import "Constant.h"
#import "AppDelegate.h"
@interface CleanKingViewController ()

@end

@implementation CleanKingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton*button=[UIButton buttonWithType:UIButtonTypeCustom];
    button.frame=CGRectMake(100, 100, 100, 100);
    button.backgroundColor=[UIColor redColor];
    [button setTitle:@"按钮" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(initData) forControlEvents:UIControlEventTouchUpInside];
   // [self.view addSubview:button];

}
-(void)initData{
    AFHTTPRequestOperationManager * manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    NSDictionary * paramter = [NSDictionary dictionary];
    
    AppDelegate*tempAppDelegate =(AppDelegate*)[[UIApplication sharedApplication]delegate];
    
    paramter=@{@"token":tempAppDelegate.token,@"key":@"ctw"};
    NSLog(@"参数：%@",paramter);
    
    NSString *string =[NSString stringWithFormat:@"%@%@",url2,@"GetCTProductByKey"];
    
    
    [manager POST:string parameters:paramter success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary * dic = (NSDictionary *)responseObject;
        
        NSLog(@"%@",dic[@"Data"]);
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"Error:%@",error);
    }];

}
-(void)viewWillAppear:(BOOL)animated{
    
    
    self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
}





@end
